<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header('通知公告列表')"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								公告类型：<select name="noticeType" style="width: 100px;" th:with="type=${@dict.getType('fantasy_notice_type')}">
								<option value="">所有</option>
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>
							</li>
							<li>
								是否置顶：<select name="isTop" style="width: 100px;">
									<option value="">所有</option>
									<option value="0">否</option>
									<option value="1">是</option>
								</select>
							</li>
							<li>
								公告内容：<input type="text" name="noticeContent" style="width: 100px;"/>
							</li>
							<li>
								备注信息：<input type="text" name="remark" style="width: 100px;"/>
							</li>

							<li>
								状态：
								<select id="delFlag" name="delFlag" style="width:100px;">
									<option value="">全部</option>
									<option value="0">正常</option>
									<option value="1">禁用</option>
								</select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="fantasy:fantasyNotice:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="fantasy:fantasyNotice:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-warning btn-del btn-del disabled" onclick="$.operate.disableAll()" shiro:hasPermission="fantasy:fantasyNotice:disable">
					<i class="fa fa-minus"></i> 禁用
				</a>
				<a class="btn btn-warning btn-del btn-del disabled" onclick="$.operate.restoreAll()" shiro:hasPermission="fantasy:fantasyNotice:disable">
					<i class="fa fa-check"></i> 还原
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="fantasy:fantasyNotice:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('fantasy:fantasyNotice:edit')}]];
        var removeFlag = [[${@permission.hasPermi('fantasy:fantasyNotice:remove')}]];
        var disableFlag = [[${@permission.hasPermi('fantasy:fantasyNotice:disable')}]];
        var prefix = ctx + "fantasy/fantasyNotice";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                disableUrl: prefix + "/disable",
                restoreUrl: prefix + "/restore",
				exportUrl: prefix + "/export",
                modalName: "公告",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'noticeId', 
					title : '序号',
					visible: false
				},
				{
					field : 'noticeType', 
					title : '公告类型',
					sortable: true
				},
				{
					field : 'isTop',
					title : '是否置顶',
					sortable: true
				},
				{
					field : 'noticeContent', 
					title : '公告内容',
					sortable: true
				},
				{
					field : 'updateBy',
					title : '更新者',
					sortable: true
				},
				{
					field : 'updateTime', 
					title : '更新时间',
					sortable: true
				},
				{
					field : 'remark', 
					title : '备注信息',
					sortable: true
				},
				{
					field : 'delFlag', 
					title : '状态',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.noticeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.noticeId + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + disableFlag + '" href="#" onclick="$.operate.disable(\'' + row.noticeId + '\')"><i class="fa fa-minus"></i>禁用</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + disableFlag + '" href="#" onclick="$.operate.restore(\'' + row.noticeId + '\')"><i class="fa fa-check"></i>还原</a> ');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>